<template>
  <div>
    <el-row>
      <el-col :span="24">
        <el-form :inline="true" class="demo-form-inline">
          <el-form-item>
            <el-input
              size="medium"
              v-model="queryStr"
              placeholder="查询"
            ></el-input>
          </el-form-item>
          <el-form-item>
            <el-button size="small" type="primary" icon="el-icon-search"
              >查询</el-button
            >
          </el-form-item>
          <el-form-item>
            <el-button
              size="small"
              @click="addition(1)"
              type="primary"
              icon="el-icon-circle-plus-outline"
              >新增</el-button
            >
          </el-form-item>
        </el-form>
      </el-col>
      <el-col :span="24">
        <div>
          <el-table :data="tableData" border style="width: 100%">
            <el-table-column prop="date" label="设备名称" width="">
            </el-table-column>
            <el-table-column prop="name" label="规格型号" width="">
            </el-table-column>
            <el-table-column prop="date1" label="维修日期" width="">
            </el-table-column>
            <el-table-column prop="address" label="修理内容"> </el-table-column>
            <el-table-column prop="address1" label="维修人员">
            </el-table-column>
            <el-table-column prop="address3" label="备注"> </el-table-column>
            <el-table-column label="操作" width="230" align="center">
              <template #default="scope">
                <el-button
                  size="mini"
                  @click="handleEdit(scope.$index, scope.row)"
                  >编辑</el-button
                >
                <el-button
                  size="mini"
                  type="danger"
                  @click="handleDelete(scope.$index, scope.row)"
                  >删除</el-button
                >
                <el-button size="mini" type="danger" icon="el-icon-download"
                  >导出</el-button
                >
              </template>
            </el-table-column>
          </el-table>
        </div>
      </el-col>
    </el-row>
    <el-dialog
      :title="single"
      v-model="plassets"
      width="30%"
      :close-on-click-modal="false"
    >
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="设备名称">
          <el-select
            v-model="form.product"
            placeholder="请选择设备"
            style="width: 300px"
          >
            <el-option
              v-for="item in typeList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="规格型号">
          <el-input v-model="form.problem" style="width: 300px"></el-input>
        </el-form-item>
        <el-form-item label="维修日期">
          <el-date-picker
            style="width: 300px"
            v-model="form.dates"
            type="date"
            placeholder="选择日期"
            format="YYYY 年 MM 月 DD 日"
          >
            >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="修理内容">
          <el-input
            style="width: 300px"
            v-model="form.content"
            type="textarea"
            :rows="2"
          ></el-input>
        </el-form-item>
        <el-form-item label="维修人员"> </el-form-item>
        <el-form-item label="备注">
          <el-input
            style="width: 300px"
            v-model="form.addnote"
            type="textarea"
            :rows="2"
          ></el-input>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      queryStr: "",
      form: {
        product: "",
        problem: "",
        dates: "",
        content: "",
        addnote: "",
      },
      typeList: [],
      plassets: false,
      single: "",
      under: 1,
      tableData: [
        {
          date: "2021/5/11",
          name: "电脑",
          date1: "xxx",
          address: "xxxx",
          address1: "xxxx",
          address2: "xxxx",
          address3: "xxxx",
        },
      ],
    };
  },
  methods: {
    addition(index) {
      this.plassets = true;
      this.under = index;
      this.single = "新增维修记录";
    },
  },
};
</script>

<style scoped>
.addccc {
  margin-bottom: 20px;
}
</style>